<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
    <meta http-equiv="X-UA-Compatible" content="chrome=1" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta name="author" content="yb">
    <meta name="keywords" content="关键词" />
    <meta name="description" content="描述" />
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
    <meta http-equiv="Expires" content="0">
    <!-- <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> -->
    <script src="https://cdn.bootcss.com/jquery/1.10.1/jquery.min.js"></script>
    <link rel="stylesheet" href="../style/css/base.css">
</head>
<body>
    <div id="erDiv">
        <input type="checkbox" erType="1">
        <input type="checkbox" erType="2">
        <input type="checkbox" erType="3">
        <input type="checkbox" erType="4">
    </div>
    <button id="btn">按钮</button>
</body>
<script>
    $('#btn').click(function(){
        var erTypeArr = [];
        var erType = $('#erDiv').find('input[type=checkbox]:checked');
        console.log(erType);
        $.each(erType,function(){
            var current1 = $(this).index(); // 遍历出被选中checkbox的 索引值
            var current2 = $(this).attr('erType'); // 遍历出被选中checkbox的 属性值

            console.log('current1='+current1);
            console.log('current2='+current2);

            erTypeArr.push(current2); 
        })
        console.log(erTypeArr);
    })
</script>